﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
using System.Windows.Data;
using MobiSms.ViewModel;

namespace MobiSms.Wasun.Views
{
    public partial class ReplyDetailsView : PhoneApplicationPage
    {
        ReplyDetailsViewModel viewmodel;

        public ReplyDetailsView()
        {
            InitializeComponent();
            this.Loaded += PageLoaded;
            viewmodel = (ReplyDetailsViewModel)LayoutRoot.DataContext;

        }

        void PageLoaded(object sender, RoutedEventArgs e)
        {
            string guid = NavigationContext.QueryString["guid"];
            viewmodel.Guid = guid;
        }

        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            //string[] objs = NavigationContext.QueryString.Values.ToArray();
            //string[] keys = NavigationContext.QueryString.Keys.ToArray();
            //string guid = NavigationContext.QueryString["guid"];
            //viewmodel.Guid = guid;
            base.OnNavigatedTo(e);
        }

        private void OnTextBoxTextChanged(object sender, TextChangedEventArgs e)
        {
            TextBox box = sender as TextBox;
            BindingExpression binding = box.GetBindingExpression(TextBox.TextProperty);
            binding.UpdateSource();
        }
    }
}